/*
 * Copyright (c) Huawei Device Co., Ltd. 2023. All rights reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#include "session.h"

#include <gtest/gtest.h>
#include <memory>

#include "channel.h"
#include "ipc_object_stub.h"
#include "loghelper.h"
#include "reader.h"
#include "se_service.h"
#include "service_manager.h"
#include "access_control_enforcer.h"
#include "secure_element_agent.h"
#include "access_rule_cache.h"
#include "ber_tlv.h"
#include "ar_do.h"
#include "ref_ar_do.h"
#include "ref_do.h"
#include "response_all_ref_ar_do.h"

namespace OHOS {
namespace SE {
namespace TEST {
using namespace testing::ext;
using namespace OHOS::SE;

class BerTlvTest : public testing::Test {
public:
    static void SetUpTestCase() {};
    static void TearDownTestCase() {};
    void SetUp();
    void TearDown();
public:
    std::shared_ptr<BerTlv> berTlv_;
};

void BerTlvTest::SetUp()
{
    InfoLog("BerTlvTest::SetUp begin!");
    std::vector<uint8_t> data;
    uint32_t tag = 0xFF;
    berTlv_ = std::make_shared<BerTlv>(data, tag);
    InfoLog("BerTlvTest::SetUp done!");
}

void BerTlvTest::TearDown()
{
    InfoLog("BerTlvTest::TearDown begin!");
    InfoLog("BerTlvTest::TearDown done!");
}

/**
 * @tc.name: GetDoTag_Test001
 * @tc.desc: Test GetDoTag.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetDoTag_Test001, TestSize.Level1)
{
    std::vector<uint8_t> rawData;
    uint32_t tag = 0;
    std::shared_ptr<BerTlv> berTlv = std::make_shared<BerTlv>(rawData, 0xFF40);
    bool statusCode = berTlv->GetDoTag(tag);
    EXPECT_FALSE(statusCode);
}

/**
 * @tc.name: GetDoTag_Test002
 * @tc.desc: Test GetDoTag.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetDoTag_Test002, TestSize.Level1)
{
    std::vector<uint8_t> rawData;
    uint32_t tag = 0;
    std::shared_ptr<BerTlv> berTlv = std::make_shared<BerTlv>(rawData, 0xDF20);
    bool statusCode = berTlv->GetDoTag(tag);
    EXPECT_FALSE(statusCode);
}

/**
 * @tc.name: GetDoTag_Test003
 * @tc.desc: Test GetDoTag.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetDoTag_Test003, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0x00, 0x00, 0x00};
    uint32_t tag = 0;
    std::shared_ptr<BerTlv> berTlv = std::make_shared<BerTlv>(rawData, 0xDF20);
    bool statusCode = berTlv->GetDoTag(tag);
    EXPECT_FALSE(!statusCode);
}

/**
 * @tc.name: GetDoTag_Test004
 * @tc.desc: Test GetDoTag.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetDoTag_Test004, TestSize.Level1)
{
    std::vector<uint8_t> rawData;
    uint32_t tag = 0;
    std::shared_ptr<BerTlv> berTlv = std::make_shared<BerTlv>(rawData, 0);
    bool statusCode = berTlv->GetDoTag(tag);
    EXPECT_FALSE(statusCode);
}

/**
 * @tc.name: GetDoTag_Test005
 * @tc.desc: Test GetDoTag.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetDoTag_Test005, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0x01, 0x02};
    uint32_t tag = 0;
    std::shared_ptr<BerTlv> berTlv = std::make_shared<BerTlv>(rawData, 0);
    bool statusCode = berTlv->GetDoTag(tag);
    EXPECT_FALSE(!statusCode);
}

/**
 * @tc.name: GetDoLength_Test001
 * @tc.desc: Test Get Length.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetDoLength_Test001, TestSize.Level1)
{
    std::vector<uint8_t> rawData;
    uint32_t dataStartIndex = 0;
    uint32_t length = 0;
    std::shared_ptr<BerTlv> berTlv = std::make_shared<BerTlv>(rawData, 0xFF40);
    bool statusCode = berTlv->GetDoLength(dataStartIndex, length);
    EXPECT_FALSE(statusCode);
}

/**
 * @tc.name: GetDoLength_Test002
 * @tc.desc: Test Get Length.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetDoLength_Test002, TestSize.Level1)
{
    std::vector<uint8_t> rawData;
    uint32_t dataStartIndex = 0;
    uint32_t length = 0;
    std::shared_ptr<BerTlv> berTlv = std::make_shared<BerTlv>(rawData, 0xDF20);
    bool statusCode = berTlv->GetDoLength(dataStartIndex, length);
    EXPECT_FALSE(statusCode);
}

/**
 * @tc.name: GetDoLength_Test003
 * @tc.desc: Test Get Length.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetDoLength_Test003, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0x00, 0x00, 0x00};
    uint32_t dataStartIndex = 0;
    uint32_t length = 10;
    std::shared_ptr<BerTlv> berTlv = std::make_shared<BerTlv>(rawData, 0xDF20);
    bool statusCode = berTlv->GetDoLength(dataStartIndex, length);
    EXPECT_FALSE(!statusCode);
}

/**
 * @tc.name: GetDoLength_Test004
 * @tc.desc: Test Get Length.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetDoLength_Test004, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0x00, 0x00, 0x01, 0x02};
    uint32_t dataStartIndex = 0;
    uint32_t length = 0;
    std::shared_ptr<BerTlv> berTlv = std::make_shared<BerTlv>(rawData, 0xDF20);
    bool statusCode = berTlv->GetDoLength(dataStartIndex, length);
    EXPECT_FALSE(!statusCode);
}

/**
 * @tc.name: GetDoLength_Test005
 * @tc.desc: Test Get Length.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetDoLength_Test005, TestSize.Level1)
{
    std::vector<uint8_t> rawData;
    uint32_t dataStartIndex = 0;
    uint32_t length = 0;
    std::shared_ptr<BerTlv> berTlv = std::make_shared<BerTlv>(rawData, 0);
    bool statusCode = berTlv->GetDoLength(dataStartIndex, length);
    EXPECT_FALSE(statusCode);
}

/**
 * @tc.name: GetDoLength_Test006
 * @tc.desc: Test Get Length.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetDoLength_Test006, TestSize.Level1)
{
    std::vector<uint8_t> rawData;
    uint32_t dataStartIndex = 0;
    uint32_t length = 0;
    std::shared_ptr<BerTlv> berTlv = std::make_shared<BerTlv>(rawData, 0);
    bool statusCode = berTlv->GetDoLength(dataStartIndex, length);
    EXPECT_FALSE(statusCode);
}

/**
 * @tc.name: GetDoLength_Test007
 * @tc.desc: Test Get Length.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetDoLength_Test007, TestSize.Level1)
{
    std::vector<uint8_t> payload;
    bool isPayload = false;
    uint32_t tag = 0xFF40;
    std::shared_ptr<BerTlv> berTlv = std::make_shared<BerTlv>(payload, isPayload, tag);
    EXPECT_TRUE(berTlv != nullptr);
}

/**
 * @tc.name: GetDoLength_Test008
 * @tc.desc: Test Get Length.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetDoLength_Test008, TestSize.Level1)
{
    std::vector<uint8_t> payload = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
        23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
        50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
        77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
        103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
        125, 126, 127, 128, 129, 130};
    bool isPayload = false;
    uint32_t tag = 0xE2;
    std::shared_ptr<BerTlv> berTlv = std::make_shared<BerTlv>(payload, isPayload, tag);
    EXPECT_TRUE(berTlv != nullptr);
}

HWTEST_F(BerTlvTest, GetDoLength_Test009, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xFF, 0x40, 0x82, 0x01, 0x29};
    rawData.resize(255, 0);
    uint32_t tag = 0xFF40;
    uint32_t dataStartIndex = 0;
    uint32_t length = 0;
    std::shared_ptr<BerTlv> berTlv = std::make_shared<BerTlv>(rawData, tag);
    bool statusCode = berTlv->GetDoLength(dataStartIndex, length);
    EXPECT_TRUE(statusCode);
}

/**
 * @tc.name: GetDoPayload_Test001
 * @tc.desc: Test Get Payload.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetDoPayload_Test001, TestSize.Level1)
{
    if (berTlv_ != nullptr) {
        std::vector<uint8_t> payload;
        bool statusCode = berTlv_->GetDoPayload(payload);
        EXPECT_FALSE(statusCode);
    }
}

/**
 * @tc.name: ParseLength_Test001
 * @tc.desc: Test Parse Rawdata.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, ParseLength_Test001, TestSize.Level1)
{
    std::vector<uint8_t> rawData;
    std::vector<uint8_t> data = {0X01, 0X02, 0X03};
    uint32_t length = 0;
    uint32_t dataStartIndex = 0;
    std::shared_ptr<BerTlv> berTlv = std::make_shared<BerTlv>(rawData, 0);
    berTlv->ParseLength(data, length, dataStartIndex);
    EXPECT_TRUE(berTlv != nullptr);
}

/**
 * @tc.name: ParseLength_Test002
 * @tc.desc: Test Parse Rawdata.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, ParseLength_Test002, TestSize.Level1)
{
    std::vector<uint8_t> rawData;
    std::vector<uint8_t> data = {0x81, 0X02, 0X03};
    uint32_t length = 0;
    uint32_t dataStartIndex = 0;
    std::shared_ptr<BerTlv> berTlv = std::make_shared<BerTlv>(rawData, 0);
    berTlv->ParseLength(data, length, dataStartIndex);
    EXPECT_TRUE(berTlv != nullptr);
}

/**
 * @tc.name: ParseLength_Test003
 * @tc.desc: Test Parse Rawdata.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, ParseLength_Test003, TestSize.Level1)
{
    std::vector<uint8_t> rawData;
    std::vector<uint8_t> data = {0x82, 0X02, 0X03};
    uint32_t length = 0;
    uint32_t dataStartIndex = 0;
    std::shared_ptr<BerTlv> berTlv = std::make_shared<BerTlv>(rawData, 0);
    berTlv->ParseLength(data, length, dataStartIndex);
    EXPECT_TRUE(berTlv != nullptr);
}

/**
 * @tc.name: ParseLength_Test004
 * @tc.desc: Test Parse Rawdata.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, ParseLength_Test004, TestSize.Level1)
{
    std::vector<uint8_t> rawData;
    std::vector<uint8_t> data = {0x83, 0X02, 0X03, 0X04, 0X05};
    uint32_t length = 0;
    uint32_t dataStartIndex = 0;
    std::shared_ptr<BerTlv> berTlv = std::make_shared<BerTlv>(rawData, 0);
    berTlv->ParseLength(data, length, dataStartIndex);
    EXPECT_TRUE(berTlv != nullptr);
}

/**
 * @tc.name: ParseLength_Test005
 * @tc.desc: Test Parse Rawdata.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, ParseLength_Test005, TestSize.Level1)
{
    std::vector<uint8_t> rawData;
    std::vector<uint8_t> data = {0x84, 0X02, 0X03, 0X04, 0X05};
    uint32_t length = 0;
    uint32_t dataStartIndex = 0;
    std::shared_ptr<BerTlv> berTlv = std::make_shared<BerTlv>(rawData, 0);
    berTlv->ParseLength(data, length, dataStartIndex);
    EXPECT_TRUE(berTlv != nullptr);
}

/**
 * @tc.name: GetRawData_Test001
 * @tc.desc: Test Parse Rawdata.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetRawData_Test001, TestSize.Level1)
{
    if (berTlv_ != nullptr) {
        std::vector<uint8_t> data;
        berTlv_->GetRawData(data);
        EXPECT_TRUE(data.empty());
    }
}

/**
 * @tc.name: GetApduArDo_Test001
 * @tc.desc: Test Parse Rawdata.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetApduArDo_Test001, TestSize.Level1)
{
    std::vector<uint8_t> rawData;
    vector<ApduArDo> retApduArDo;
    std::shared_ptr<ArDo> arDo = std::make_shared<ArDo>(rawData);
    bool statusCode = arDo->GetApduArDo(retApduArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetApduArDo_Test002
 * @tc.desc: Test Parse Rawdata.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetApduArDo_Test002, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0x01, 0x02, 0x03};
    vector<ApduArDo> retApduArDo;
    std::shared_ptr<ArDo> arDo = std::make_shared<ArDo>(rawData);
    bool statusCode = arDo->GetApduArDo(retApduArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetApduArDo_Test003
 * @tc.desc: Test Parse Rawdata.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetApduArDo_Test003, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE3};
    vector<ApduArDo> retApduArDo;
    std::shared_ptr<ArDo> arDo = std::make_shared<ArDo>(rawData);
    bool statusCode = arDo->GetApduArDo(retApduArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetApduArDo_Test004
 * @tc.desc: Test Parse Rawdata.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetApduArDo_Test004, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE3, 0x81, 0x02};
    vector<ApduArDo> retApduArDo;
    std::shared_ptr<ArDo> arDo = std::make_shared<ArDo>(rawData);
    bool statusCode = arDo->GetApduArDo(retApduArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetApduArDo_Test005
 * @tc.desc: Test Parse Rawdata.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetApduArDo_Test005, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE3, 0x00, 0x02};
    vector<ApduArDo> retApduArDo;
    std::shared_ptr<ArDo> arDo = std::make_shared<ArDo>(rawData);
    bool statusCode = arDo->GetApduArDo(retApduArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetApduArDo_Test006
 * @tc.desc: Test Parse Rawdata.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetApduArDo_Test006, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE3, 0x02, 0x02, 0x03, 0x04};
    vector<ApduArDo> retApduArDo;
    std::shared_ptr<ArDo> arDo = std::make_shared<ArDo>(rawData);
    bool statusCode = arDo->GetApduArDo(retApduArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetApduArDo_Test007
 * @tc.desc: Test Parse Rawdata.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetApduArDo_Test007, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE3, 0xD0, 0x02, 0x03, 0x04};
    vector<ApduArDo> retApduArDo;
    std::shared_ptr<ArDo> arDo = std::make_shared<ArDo>(rawData);
    bool statusCode = arDo->GetApduArDo(retApduArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetApduArDo_Test008
 * @tc.desc: Test Parse Rawdata.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetApduArDo_Test008, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE3, 0x02, 0x02, 0x03, 0x04};
    vector<ApduArDo> retApduArDo;
    std::shared_ptr<ArDo> arDo = std::make_shared<ArDo>(rawData);
    bool statusCode = arDo->GetApduArDo(retApduArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetApduArDo_Test009
 * @tc.desc: Test Parse Rawdata.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetApduArDo_Test009, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE3, 0x02, 0xD0, 0x03, 0x04};
    vector<ApduArDo> retApduArDo;
    std::shared_ptr<ArDo> arDo = std::make_shared<ArDo>(rawData);
    bool statusCode = arDo->GetApduArDo(retApduArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetApduArDo_Test010
 * @tc.desc: Test Parse Rawdata.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetApduArDo_Test010, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE3, 0x02, 0xD0, 0x04};
    vector<ApduArDo> retApduArDo;
    std::shared_ptr<ArDo> arDo = std::make_shared<ArDo>(rawData);
    bool statusCode = arDo->GetApduArDo(retApduArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetApduArDo_Test011
 * @tc.desc: Test Parse Rawdata.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetApduArDo_Test011, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE3, 0x02, 0xD0, 0x00};
    vector<ApduArDo> retApduArDo;
    std::shared_ptr<ArDo> arDo = std::make_shared<ArDo>(rawData);
    bool statusCode = arDo->GetApduArDo(retApduArDo);
    EXPECT_TRUE(statusCode);
}

/**
 * @tc.name: GetRefDoAndArDo_Test001
 * @tc.desc: Test Parse GetRefDoAndArDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetRefDoAndArDo_Test001, TestSize.Level1)
{
    std::vector<uint8_t> rawData;
    vector<RefDo> retRefDo;
    vector<ArDo> retArDo;
    std::shared_ptr<RefArDo> refArDo = std::make_shared<RefArDo>(rawData);
    bool statusCode = refArDo->GetRefDoAndArDo(retRefDo, retArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetRefDoAndArDo_Test002
 * @tc.desc: Test Parse GetRefDoAndArDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetRefDoAndArDo_Test002, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0x01, 0x02, 0x03};
    vector<RefDo> retRefDo;
    vector<ArDo> retArDo;
    std::shared_ptr<RefArDo> refArDo = std::make_shared<RefArDo>(rawData);
    bool statusCode = refArDo->GetRefDoAndArDo(retRefDo, retArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetRefDoAndArDo_Test003
 * @tc.desc: Test Parse GetRefDoAndArDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetRefDoAndArDo_Test003, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE2, 0x02, 0x03};
    vector<RefDo> retRefDo;
    vector<ArDo> retArDo;
    std::shared_ptr<RefArDo> refArDo = std::make_shared<RefArDo>(rawData);
    bool statusCode = refArDo->GetRefDoAndArDo(retRefDo, retArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetRefDoAndArDo_Test004
 * @tc.desc: Test Parse GetRefDoAndArDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetRefDoAndArDo_Test004, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE2, 0x00, 0x02, 0x03, 0x04, 0x05};
    vector<RefDo> retRefDo;
    vector<ArDo> retArDo;
    std::shared_ptr<RefArDo> refArDo = std::make_shared<RefArDo>(rawData);
    bool statusCode = refArDo->GetRefDoAndArDo(retRefDo, retArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetRefDoAndArDo_Test005
 * @tc.desc: Test Parse GetRefDoAndArDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetRefDoAndArDo_Test005, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE2, 0x81, 0x02, 0x03, 0x04, 0x05};
    vector<RefDo> retRefDo;
    vector<ArDo> retArDo;
    std::shared_ptr<RefArDo> refArDo = std::make_shared<RefArDo>(rawData);
    bool statusCode = refArDo->GetRefDoAndArDo(retRefDo, retArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetRefDoAndArDo_Test006
 * @tc.desc: Test Parse GetRefDoAndArDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetRefDoAndArDo_Test006, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE2, 0x81, 0x05, 0xE1, 0x04, 0x05, 0x06, 0x06, 0x06};
    vector<RefDo> retRefDo;
    vector<ArDo> retArDo;
    std::shared_ptr<RefArDo> refArDo = std::make_shared<RefArDo>(rawData);
    bool statusCode = refArDo->GetRefDoAndArDo(retRefDo, retArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetRefDoAndArDo_Test007
 * @tc.desc: Test Parse GetRefDoAndArDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetRefDoAndArDo_Test007, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE2, 0x81, 0x06, 0xE1, 0x04, 0x05, 0x06, 0x06, 0x06, 0x03};
    vector<RefDo> retRefDo;
    vector<ArDo> retArDo;
    std::shared_ptr<RefArDo> refArDo = std::make_shared<RefArDo>(rawData);
    bool statusCode = refArDo->GetRefDoAndArDo(retRefDo, retArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetRefDoAndArDo_Test0008
 * @tc.desc: Test Parse GetRefDoAndArDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetRefDoAndArDo_Test0008, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE2, 0x03, 0xE1, 0x04, 0x04};
    vector<RefDo> retRefDo;
    vector<ArDo> retArDo;
    std::shared_ptr<RefArDo> refArDo = std::make_shared<RefArDo>(rawData);
    bool statusCode = refArDo->GetRefDoAndArDo(retRefDo, retArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetRefDoAndArDo_Test008
 * @tc.desc: Test Parse GetRefDoAndArDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetRefDoAndArDo_Test008, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE2, 0x03, 0xE1, 0xE1, 0x04, 0x05, 0x06, 0x06, 0x06, 0x03};
    vector<RefDo> retRefDo;
    vector<ArDo> retArDo;
    std::shared_ptr<RefArDo> refArDo = std::make_shared<RefArDo>(rawData);
    bool statusCode = refArDo->GetRefDoAndArDo(retRefDo, retArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetRefDoAndArDo_Test009
 * @tc.desc: Test Parse GetRefDoAndArDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetRefDoAndArDo_Test009, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE2, 0x03, 0xE1, 0xE3, 0x04, 0x05, 0x06, 0x06, 0x06, 0x03};
    vector<RefDo> retRefDo;
    vector<ArDo> retArDo;
    std::shared_ptr<RefArDo> refArDo = std::make_shared<RefArDo>(rawData);
    bool statusCode = refArDo->GetRefDoAndArDo(retRefDo, retArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetRefDoAndArDo_Test010
 * @tc.desc: Test Parse GetRefDoAndArDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetRefDoAndArDo_Test010, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE2, 0x05, 0xE1, 0xE3, 0x00, 0x05, 0x06, 0x06, 0x06, 0x03};
    vector<RefDo> retRefDo;
    vector<ArDo> retArDo;
    std::shared_ptr<RefArDo> refArDo = std::make_shared<RefArDo>(rawData);
    bool statusCode = refArDo->GetRefDoAndArDo(retRefDo, retArDo);
    EXPECT_TRUE(statusCode);
}

/**
 * @tc.name: GetAidRefDoAndDeviceAppDo_Test001
 * @tc.desc: Test Parse GetAidRefDoAndDeviceAppDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetAidRefDoAndDeviceAppDo_Test001, TestSize.Level1)
{
    std::vector<uint8_t> rawData;
    vector<AidRefDo> retAidRefDo;
    vector<DeviceAppIdRefDo> retDeviceAppDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetAidRefDoAndDeviceAppDo(retAidRefDo, retDeviceAppDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetAidRefDoAndDeviceAppDo_Test002
 * @tc.desc: Test Parse GetAidRefDoAndDeviceAppDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetAidRefDoAndDeviceAppDo_Test002, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0x01, 0x02};
    vector<AidRefDo> retAidRefDo;
    vector<DeviceAppIdRefDo> retDeviceAppDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetAidRefDoAndDeviceAppDo(retAidRefDo, retDeviceAppDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetAidRefDoAndDeviceAppDo_Test003
 * @tc.desc: Test Parse GetAidRefDoAndDeviceAppDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetAidRefDoAndDeviceAppDo_Test003, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE1, 0x01};
    vector<AidRefDo> retAidRefDo;
    vector<DeviceAppIdRefDo> retDeviceAppDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetAidRefDoAndDeviceAppDo(retAidRefDo, retDeviceAppDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetAidRefDoAndDeviceAppDo_Test004
 * @tc.desc: Test Parse GetAidRefDoAndDeviceAppDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetAidRefDoAndDeviceAppDo_Test004, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE1, 0x00};
    vector<AidRefDo> retAidRefDo;
    vector<DeviceAppIdRefDo> retDeviceAppDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetAidRefDoAndDeviceAppDo(retAidRefDo, retDeviceAppDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetAidRefDoAndDeviceAppDo_Test005
 * @tc.desc: Test Parse GetAidRefDoAndDeviceAppDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetAidRefDoAndDeviceAppDo_Test005, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE1, 0x01, 0x03, 0x04};
    vector<AidRefDo> retAidRefDo;
    vector<DeviceAppIdRefDo> retDeviceAppDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetAidRefDoAndDeviceAppDo(retAidRefDo, retDeviceAppDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetAidRefDoAndDeviceAppDo_Test006
 * @tc.desc: Test Parse GetAidRefDoAndDeviceAppDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetAidRefDoAndDeviceAppDo_Test006, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE1, 0x02, 0x4F, 0x04};
    vector<AidRefDo> retAidRefDo;
    vector<DeviceAppIdRefDo> retDeviceAppDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetAidRefDoAndDeviceAppDo(retAidRefDo, retDeviceAppDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetAidRefDoAndDeviceAppDo_Test007
 * @tc.desc: Test Parse GetAidRefDoAndDeviceAppDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetAidRefDoAndDeviceAppDo_Test007, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE1, 0x02, 0xC0, 0x00};
    vector<AidRefDo> retAidRefDo;
    vector<DeviceAppIdRefDo> retDeviceAppDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetAidRefDoAndDeviceAppDo(retAidRefDo, retDeviceAppDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetAidRefDoAndDeviceAppDo_Test008
 * @tc.desc: Test Parse GetAidRefDoAndDeviceAppDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetAidRefDoAndDeviceAppDo_Test008, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE1, 0x02, 0xC0, 0x00, 0x05};
    vector<AidRefDo> retAidRefDo;
    vector<DeviceAppIdRefDo> retDeviceAppDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetAidRefDoAndDeviceAppDo(retAidRefDo, retDeviceAppDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetAidRefDoAndDeviceAppDo_Test009
 * @tc.desc: Test Parse GetAidRefDoAndDeviceAppDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetAidRefDoAndDeviceAppDo_Test009, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE1, 0x02, 0xC0, 0x00, 0x05};
    vector<AidRefDo> retAidRefDo;
    vector<DeviceAppIdRefDo> retDeviceAppDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetAidRefDoAndDeviceAppDo(retAidRefDo, retDeviceAppDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetAidRefDoAndDeviceAppDo_Test010
 * @tc.desc: Test Parse GetAidRefDoAndDeviceAppDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetAidRefDoAndDeviceAppDo_Test010, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE1, 0x03, 0xC0, 0x00, 0x05};
    vector<AidRefDo> retAidRefDo;
    vector<DeviceAppIdRefDo> retDeviceAppDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetAidRefDoAndDeviceAppDo(retAidRefDo, retDeviceAppDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetAidRefDoAndDeviceAppDo_Test011
 * @tc.desc: Test Parse GetAidRefDoAndDeviceAppDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetAidRefDoAndDeviceAppDo_Test011, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE1, 0x04, 0xC0, 0x00, 0xC1, 0x00};
    vector<AidRefDo> retAidRefDo;
    vector<DeviceAppIdRefDo> retDeviceAppDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetAidRefDoAndDeviceAppDo(retAidRefDo, retDeviceAppDo);
    EXPECT_TRUE(statusCode);
}

/**
 * @tc.name: GetAidRefDo_Test001
 * @tc.desc: Test Parse GetAidRefDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetAidRefDo_Test001, TestSize.Level1)
{
    std::vector<uint8_t> rawData;
    vector<AidRefDo> retAidRefDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetAidRefDo(retAidRefDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetAidRefDo_Test002
 * @tc.desc: Test Parse GetAidRefDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetAidRefDo_Test002, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0x01, 0x02};
    vector<AidRefDo> retAidRefDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetAidRefDo(retAidRefDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetAidRefDo_Test003
 * @tc.desc: Test Parse GetAidRefDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetAidRefDo_Test003, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE1, 0x02};
    vector<AidRefDo> retAidRefDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetAidRefDo(retAidRefDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetAidRefDo_Test004
 * @tc.desc: Test Parse GetAidRefDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetAidRefDo_Test004, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE1, 0x00};
    vector<AidRefDo> retAidRefDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetAidRefDo(retAidRefDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetAidRefDo_Test005
 * @tc.desc: Test Parse GetAidRefDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetAidRefDo_Test005, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE1, 0x01, 0x03, 0x04};
    vector<AidRefDo> retAidRefDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetAidRefDo(retAidRefDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetAidRefDo_Test006
 * @tc.desc: Test Parse GetAidRefDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetAidRefDo_Test006, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE1, 0x02, 0x4F, 0x04};
    vector<AidRefDo> retAidRefDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetAidRefDo(retAidRefDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetAidRefDo_Test007
 * @tc.desc: Test Parse GetAidRefDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetAidRefDo_Test007, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE1, 0x02, 0xC0, 0x00};
    vector<AidRefDo> retAidRefDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetAidRefDo(retAidRefDo);
    EXPECT_TRUE(statusCode);
}

/**
 * @tc.name: GetAidRefDo_Test008
 * @tc.desc: Test Parse GetAidRefDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetAidRefDo_Test008, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE1, 0x02, 0xC0, 0x00, 0x05};
    vector<AidRefDo> retAidRefDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetAidRefDo(retAidRefDo);
    EXPECT_TRUE(statusCode);
}

/**
 * @tc.name: GetDeviceAppDo_Test001
 * @tc.desc: Test Parse GetDeviceAppDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetDeviceAppDo_Test001, TestSize.Level1)
{
    std::vector<uint8_t> rawData;
    vector<DeviceAppIdRefDo> retDeviceAppDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetDeviceAppDo(retDeviceAppDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetDeviceAppDo_Test002
 * @tc.desc: Test Parse GetDeviceAppDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetDeviceAppDo_Test002, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0x01, 0x02};
    vector<DeviceAppIdRefDo> retDeviceAppDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetDeviceAppDo(retDeviceAppDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetDeviceAppDo_Test003
 * @tc.desc: Test Parse GetDeviceAppDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetDeviceAppDo_Test003, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE1, 0x02};
    vector<DeviceAppIdRefDo> retDeviceAppDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetDeviceAppDo(retDeviceAppDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetDeviceAppDo_Test004
 * @tc.desc: Test Parse GetDeviceAppDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetDeviceAppDo_Test004, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE1, 0x00};
    vector<DeviceAppIdRefDo> retDeviceAppDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetDeviceAppDo(retDeviceAppDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetDeviceAppDo_Test005
 * @tc.desc: Test Parse GetDeviceAppDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetDeviceAppDo_Test005, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE1, 0x01, 0x03, 0x04};
    vector<DeviceAppIdRefDo> retDeviceAppDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetDeviceAppDo(retDeviceAppDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetDeviceAppDo_Test006
 * @tc.desc: Test Parse GetDeviceAppDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetDeviceAppDo_Test006, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE1, 0x02, 0xC1, 0x04};
    vector<DeviceAppIdRefDo> retDeviceAppDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetDeviceAppDo(retDeviceAppDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetDeviceAppDo_Test007
 * @tc.desc: Test Parse GetDeviceAppDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetDeviceAppDo_Test007, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xE1, 0x02, 0xC1, 0x00};
    vector<DeviceAppIdRefDo> retDeviceAppDo;
    std::shared_ptr<RefDo> refDo = std::make_shared<RefDo>(rawData);
    bool statusCode = refDo->GetDeviceAppDo(retDeviceAppDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetRefArDo_Test001
 * @tc.desc: Test Parse GetRefArDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetRefArDo_Test001, TestSize.Level1)
{
    std::vector<uint8_t> rawData;
    vector<RefArDo> retRefArDo;
    std::shared_ptr<ResponseAllRefArDo> responseAllRefArDo = std::make_shared<ResponseAllRefArDo>(rawData);
    bool statusCode = responseAllRefArDo->GetRefArDo(retRefArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetRefArDo_Test002
 * @tc.desc: Test Parse GetRefArDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetRefArDo_Test002, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0x01, 0x02};
    vector<RefArDo> retRefArDo;
    std::shared_ptr<ResponseAllRefArDo> responseAllRefArDo = std::make_shared<ResponseAllRefArDo>(rawData);
    bool statusCode = responseAllRefArDo->GetRefArDo(retRefArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetRefArDo_Test003
 * @tc.desc: Test Parse GetRefArDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetRefArDo_Test003, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xff, 0x40};
    vector<RefArDo> retRefArDo;
    std::shared_ptr<ResponseAllRefArDo> responseAllRefArDo = std::make_shared<ResponseAllRefArDo>(rawData);
    bool statusCode = responseAllRefArDo->GetRefArDo(retRefArDo);
    EXPECT_TRUE(!statusCode);
}

/**
 * @tc.name: GetRefArDo_Test004
 * @tc.desc: Test Parse GetRefArDo.
 * @tc.type: FUNC
 */
HWTEST_F(BerTlvTest, GetRefArDo_Test004, TestSize.Level1)
{
    std::vector<uint8_t> rawData = {0xff, 0x40, 0x00, 0x00};
    vector<RefArDo> retRefArDo;
    std::shared_ptr<ResponseAllRefArDo> responseAllRefArDo = std::make_shared<ResponseAllRefArDo>(rawData);
    bool statusCode = responseAllRefArDo->GetRefArDo(retRefArDo);
    EXPECT_TRUE(!statusCode);
}

} // TEST
} // SE
} // OHOS